﻿''' <summary>
''' Use for do an action after a time.
''' </summary>
Public Class CallAfter
    Inherits Timer
    ''' <summary>
    ''' Do an action after a time.
    ''' </summary>
    ''' <param name="Wait">Time for waiting in miliseconds.</param>
    ''' <param name="Action">An action to do.</param>
    ''' <param name="Args">Arguments for doing action.</param>
    ''' <remarks></remarks>
    Public Sub CallAfter(ByVal Wait As Integer, ByVal Action As System.Delegate, ByVal ParamArray Args As Object())
        Me.Interval = Wait
        AddHandler Me.Tick, Sub(sender As Object, e As EventArgs)
                                Action.DynamicInvoke(Args)

                                Me.Enabled = False
                            End Sub
        Me.Enabled = True
    End Sub
End Class
